<?php
	include_once 'isLogin.php';
	$table='user_educate_experience';			//会员教育经历表
	$userc=new user();
	$user_id=$_GET['id'];		//会员id
	$eid=$_GET['eid'];			//教育经历id

	//教育经历删除
	if($_GET['action']=='del'){
		$res=$commonc->del($table,$eid.',');
	}

	//批量删除
	if($_GET['action']=='delMany'){
		$id=$_POST['id'];
		$res=$commonc->del($table,$id);
		echo $res;
		exit();
	}

	//教育经历添加
	if($_GET['action']=='add'){
		$school=$_POST['school'];
		$profession=$_POST['profession']==''?null:$_POST['profession'];
		$arr=array('user_id'=>$user_id,'school'=>$school,'profession'=>$profession,'create_time'=>time());
		$res=$commonc->insert($table,$arr);
		$id=$commonc->insert_id();
		$html='';
		if($res>0){
			$html.='<tr><td> <input type="checkbox" name="checkbox" value="'.$id.'" /></td><td >'.$school.'</td> <td>'.$profession.'</td>
  <td class="xiugai"><a href="user_educate.php?id='.$user_id.'&action=del&eid='.$id.'">删除</a></td></tr>';
		}
		$result=array('error'=>$res,'html'=>$html);
		echo json_encode($result);
		exit();
	}

	//会员教育经历信息					
	$where=' and ue.user_id="'.$user_id.'" order by ue.id desc';
	$key='*';
	$educates=$userc->educateList($where,$key);
	$smarty->assign('educates',$educates['result']);

	
	$smarty->display("user_educate.html");
?>